package com.janwen.j2se.thread;

import java.util.Random;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class QPThreadLocal {

	
	private static final ThreadLocal<String> th = new ThreadLocal<String>();
	private static final Log logger = LogFactory.getLog(QPThreadLocal.class);
	private static String t = "abc_";
	
	
	public void setTh(){
		int random = new Random().nextInt(10);
		th.set(random + t);
		logger.info(Thread.currentThread().getName() +   " | " + th.get());
	}
	
	public void printLocal(){
		logger.info(Thread.currentThread().getName() +  "_ " + th.get());
	}
}
